package com.study.kt._01grammar._01basic

import java.awt.image.BufferedImage
import java.io.File
import javax.imageio.ImageIO

fun main() {
    //在内存中创建一个图片
    val image = BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB)
    image.setRGB(10, 10, 0xFF0000)
    ImageIO.write(image, "bmp", File("a.bmp"))

    // IO 扩展函数
    File("a.txt").useLines { lines ->
        lines.iterator().forEach {
            println(it)
        }
    }
}